<?php

use app\modules\admin\models\Menu;
use app\modules\admin\models\Route;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\modules\admin\models\Menu */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="col-sm-12">
    <div class="box box-primary">
        <?php $form = ActiveForm::begin(); ?>
        <div class="box-header">
            <h3 class="box-title"><?= $this->title ?></h3>
        </div>
        <div class="box-body">
            <div class="col-sm-6">
            <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

            <?= $form->field($model, 'parent')->dropDownList(Menu::getAvailableMenuWithLevel(), ['prompt'=>'顶层菜单']) ?>

            <?= $form->field($model, 'route')->dropDownList(Route::getAssignedRoutes(true), ['prompt' => '选择一个路由']) ?>
            </div>
            <div class="col-sm-6">
            <?= $form->field($model, 'order')->textInput() ?>

            <?= $form->field($model, 'data')->textarea(['rows'=>4]) ?>
            </div>
        </div>
        <div class="box-footer">
            <?= Html::submitButton($model->isNewRecord ? '新建' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success pull-right' : 'btn btn-primary pull-right']) ?>
        </div>

        <?php ActiveForm::end(); ?>
    </div>
</div>